home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 52
/
Volume 52 - JOGO DISK .iso
/
Games
/
shopdrop.swf
/
scripts
/
__Packages
/
smashing
/
Menu.as
< prev
next >
Wrap
Text File
|
2007-09-27
|
4KB
|
148 lines
class smashing.Menu extends MovieClip
{
static var bInited = smashing.Menu.init();
var bEnabled = true;
function Menu()
{
super();
smashing.Menu.target = this;
}
static function init()
{
smashing.Menu.aWatched = [];
return true;
}
function onShow()
{
}
function onResume()
{
}
function show(sFrame)
{
this.onShow();
this.gotoAndPlay(sFrame);
}
function resume()
{
this.onResume();
this.gotoAndStop("blank");
}
function restoreVals()
{
var _loc3_ = smashing.Menu.aWatched;
var _loc4_ = _loc3_.length;
var _loc1_ = undefined;
var _loc2_ = 0;
while(_loc2_ < _loc4_)
{
_loc1_ = _loc3_[_loc2_];
if(_loc1_.fMethod != undefined)
{
_loc1_.fMethod(_loc1_.sProp,"foo",smashing.Menu.target[_loc1_.sProp + "cache"]);
}
_loc2_ = _loc2_ + 1;
}
}
function playAgain()
{
}
static function watchProp(o, sProp, sType)
{
var _loc1_ = new smashing.MenuEntry();
_loc1_.sProp = sProp;
switch(sType)
{
case "text":
o.watch(sProp,smashing.Menu.watchText);
_loc1_.fMethod = smashing.Menu.watchText;
break;
case "frameMeter":
o.watch(sProp,smashing.Menu.watchFrameMeter);
_loc1_.fMethod = smashing.Menu.watchFrameMeter;
break;
case "frameAnimMeter":
o.watch(sProp,smashing.Menu.watchFrameAnimMeter);
_loc1_.fMethod = smashing.Menu.restoreFrameAnimMeter;
break;
case "pegboard":
o.watch(sProp,smashing.Menu.watchPegboard);
_loc1_.fMethod = smashing.Menu.watchPegboard;
break;
case "signboard":
o.watch(sProp,smashing.Menu.watchSignboard);
break;
case "singleDigit":
o.watch(sProp,smashing.Menu.watchSingleDigit);
_loc1_.fMethod = smashing.Menu.watchSingleDigit;
}
smashing.Menu.aWatched.push(_loc1_);
}
static function watchText(prop, oldVal, newVal)
{
smashing.Menu.target[prop.toString()] = newVal;
smashing.Menu.target[prop.toString() + "cache"] = newVal;
return newVal;
}
static function watchFrameMeter(prop, oldVal, newVal)
{
var _loc2_ = smashing.Menu.target[prop.toString()];
var _loc1_ = Math.ceil(newVal * _loc2_._totalframes);
if(_loc1_ == 0)
{
_loc1_ = 1;
}
_loc2_.gotoAndStop(_loc1_);
smashing.Menu.target[prop.toString() + "cache"] = newVal;
return newVal;
}
static function watchFrameAnimMeter(prop, oldVal, newVal)
{
var _loc1_ = smashing.Menu.target[prop.toString()];
var _loc2_ = newVal;
_loc1_.gotoAndPlay("life" + _loc2_);
smashing.Menu.target[prop.toString() + "cache"] = newVal;
return newVal;
}
static function restoreFrameAnimMeter(prop, oldVal, newVal)
{
var _loc1_ = smashing.Menu.target[prop.toString()];
var _loc2_ = newVal;
_loc1_.gotoAndStop("rest" + _loc2_);
smashing.Menu.target[prop.toString() + "cache"] = newVal;
return newVal;
}
static function watchPegboard(prop, oldVal, newVal)
{
var _loc3_ = smashing.Menu.target[prop.toString()];
_loc3_.pegs = newVal;
smashing.Menu.target[prop.toString() + "cache"] = newVal;
return newVal;
}
static function watchSignboard(prop, oldVal, newVal)
{
var _loc4_ = 1;
var _loc2_ = smashing.Menu.target[prop.toString()];
_loc2_.gotoAndStop(newVal);
_loc2_.startTime = getTimer();
_loc2_.limit = _loc4_;
_loc2_.onEnterFrame = function()
{
var _loc2_ = (getTimer() - this.startTime) / 1000;
if(_loc2_ >= this.limit)
{
this._visible = false;
delete this.onEnterFrame;
}
};
return newVal;
}
static function watchSingleDigit(prop, oldVal, newVal)
{
var _loc1_ = smashing.Menu.target[prop.toString()];
_loc1_.gotoAndStop(newVal + 1);
smashing.Menu.target[prop.toString() + "cache"] = newVal + 1;
return newVal;
}
}